﻿/*
最短距离的两点 
Time Limit:1000MS  Memory Limit:32768K

  
Description:
给出一些整数对，它们表示平面上的点，求所有这些点中距离最近的两个点。
结构为：每组数据的第一行只有一个整数N，表示后面有N个点。
求这些点中的两点，以表明该两点是所有点中距离最短的。
若N为0，则表示输入结束。

Sample Input:
4
1 2
0 0
3 6
7 2
3
1 3
3 1
0 0
0
Sample Output:
(1,2) (0,0)
(1,3) (3,1)
*/
/*
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
int main()
{
	for (unsigned n; ;)
	{
		scanf("%u", &n);
		if (0 == n)
			return EXIT_FAILURE;
		else
		{
			unsigned distance = UINT_MAX;
			unsigned index1=0, index2=0;
			unsigned array_size = 2 * n + 1;
			unsigned * pts = new unsigned[array_size];
			for (unsigned i = 0; (i+1)< array_size; i += 2)
			{
				scanf("%u%u", pts + i, pts + i + 1);
				if (i >= 2)
					for (unsigned j = 0; (j+1) < i; j += 2)
					{
						unsigned tmp = (pts[i] - pts[j]) * (pts[i] - pts[j]) +
							(pts[i + 1] - pts[j + 1]) * (pts[i + 1] -
							pts[j + 1]);
						//printf(":%u\n", tmp);
						if (tmp < distance)
						{
							distance = tmp;
							index1 = i;
							index2 = j;
						}
					}
			}
			printf("(%u,%u) (%u,%u)\n", pts[index1], pts[index1 + 1],
				pts[index2], pts[index2 + 1]);
			delete []pts;
			pts = NULL;
		}
	}	

	return EXIT_SUCCESS;
}
*/

#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
int main()
{
	for (unsigned n; ;)
	{
		scanf("%u", &n);
		if (0 == n)
			break;
		else
		{
			unsigned distance = UINT_MAX;
			unsigned index1=0, index2=0;
			unsigned array_size = 2 * n + 1;
			unsigned * pts = new unsigned[array_size];
			{
				for (unsigned i = 0; (i+1)< array_size; i += 2)
				{
					scanf("%u%u", pts + i, pts + i + 1);
				}
			}
			for (unsigned i = 2; (i+1)< array_size; i += 2)
			{
				for (unsigned j = 0; (j+1) < i; j += 2)
				{
					unsigned tmp = (pts[i] - pts[j]) * (pts[i] - pts[j]) +
						(pts[i + 1] - pts[j + 1]) * (pts[i + 1] -
						pts[j + 1]);
					//printf(":%u\n", tmp);
					if (tmp < distance)
					{
						distance = tmp;
						index1 = j;
						index2 = i;
					}
				}
			}

			printf("(%u,%u) (%u,%u)\n", pts[index1], pts[index1 + 1],
				pts[index2], pts[index2 + 1]);
			delete []pts;
			pts = NULL;
		}
	}	
	
	return EXIT_SUCCESS;
}

